Skip to content

Conversation

devonh
Copy link
Member

@devonh devonh commented Oct 1, 2025

Implements: matrix-org/matrix-spec-proposals#4360

Disclaimer: I used Claude Code in a consultative manner to assist with parts of this PR.
I used it mainly for considering options for the SQL query and to generate test cases.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

) -> JsonDict:
"""Get related events of a event, ordered by topological ordering.
TODO Accept a PaginationConfig instead of individual pagination parameters.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been done alread, the comment just wasn't updated.

Comment on lines +1202 to +1217
WHERE EXISTS (
SELECT 1
FROM room_memberships AS rm
WHERE rm.room_id = threads.room_id
AND rm.user_id = ?
AND rm.event_stream_ordering <= threads.stream_ordering
AND rm.membership = ?
AND NOT EXISTS (
SELECT 1
FROM room_memberships AS rm2
WHERE rm2.room_id = rm.room_id
AND rm2.user_id = rm.user_id
AND rm2.event_stream_ordering > rm.event_stream_ordering
AND rm2.event_stream_ordering <= threads.stream_ordering
)
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this does what the comment says. That is to check if there exists a "join" membership event for this user in this room that is the latest membership event prior to the thread event stream_ordering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant